package linwen.wang.guava.eventbus;

import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @ClassName EventHandler
 * @Description eventHandler
 * @Author lin
 * @Date 2021/11/5 下午11:39
 * @Version V1.0
 */
@Component
@Slf4j
public class EventHandler {
    @Autowired
    private EventBus eventBus;

    @Autowired
    private AsyncEventBus asyncEventBus;

    @Autowired
    private EventListener eventListener;

    @PostConstruct
    public void init() {
        eventBus.register(eventListener);
        asyncEventBus.register(eventListener);
    }
}
